package com.naiterui.ehp.bs.emr.utils.his.param.resp;

import cn.hutool.json.JSONObject;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

/**
 * @author yiren
 * @since 2022/1/26
 */
@Data
@Builder
public class AnalyzeResult {
	@ApiModelProperty(value = "项目名称")
	private String name;

	@ApiModelProperty(value = "化验结果")
	private String result;

	@ApiModelProperty(value = "参考值")
	private String reference;
	public static AnalyzeResult of(JSONObject json){
		String itemName = json.getStr("itemName");
		String jg = json.getStr("jg");
		return AnalyzeResult.builder()
				.name(itemName != null ? itemName.trim() : "")
				.result(jg != null ? jg.trim() : "")
				.reference(json.getStr("itemReference"))
				.build();
	}
}
